Skip to content

Conversation

@ascibisz
Copy link
Contributor

@ascibisz ascibisz commented May 2, 2025

Time estimate or Size

Medium-ish

Problem

Creating a new converter for Mem3DG output data
Link to story or ticket

Solution

This converter ended up different than the normal simulariumio converters. Mem3DG creates a single .nc file, which in all the examples I successfully ran looks like a mesh object that changes across the timesteps.

The best / only way I came up with to bring this into simularium was to take the mesh data at each time stamp and convert that into a .obj mesh file, which simularium knows how to render. Then, generate a simularium file that references each of these generated mesh files.

This does work, but we have these pieces that are different than the "normal" simulariumio / simularium pattern

  1. Rather than generating a single .simularium file via simulariumio, this generates one .simularium files and as many .obj files as there are timesteps
  2. To get the trajectory to load in simularium with the files locally, you have to import the .simularium file and all of the .obj files
  3. Each time step is a different agent, which visually isn't too bad since they'll just show up as subtypes of the same original type, but it's still different than usual

Also one outstanding question I have not yet answered: is there a situation in which a single .nc file would represent multiple distinct meshes? This converter code currently assumes one .nc file -> 1 mesh agent per timestep -> 1 .obj file generated per timestep.

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires updated or new tests

Change summary:

  • Added the Mem3dg converter, and all the things that tend to come with a new converter (Mem3dgData, unit tests, and jupyter notebook example)

Steps to Verify:

The best way to test this would be by checking out this branch and trying the Jupyter Notebook tutorial file! If it anything doesn't work or if it's confusing, that is all helpful feedback :)

@ascibisz ascibisz linked an issue May 2, 2025 that may be closed by this pull request
@ascibisz ascibisz marked this pull request as ready for review May 2, 2025 20:22
@ascibisz ascibisz requested a review from a team as a code owner May 2, 2025 20:22
@ascibisz ascibisz requested review from interim17, meganrm and rugeli and removed request for a team May 2, 2025 20:22
object_display_data = DisplayData(
name=f"{base_agent_name}#frame{frame}",
display_type=DISPLAY_TYPE.OBJ,
url=f"{frame}.obj",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice job fixing the path issue! The different between url and output_file_path isn't immediately clear, perhaps rename url to clarify?

Copy link

@interim17 interim17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, haven' run it.

The multiple .obj to one simualarium file pattern is interesting to me. It reminds me a bit of .zarr and seems like a way we could approach have different levels of resolution in a simularium file going forward if and when we take a look at the file structure or aim to work on that feature.

@ascibisz ascibisz merged commit 2280752 into main May 14, 2025
5 checks passed
@ascibisz ascibisz deleted the feature/mem3dg-converter branch May 14, 2025 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Convert MEM3DG models

5 participants